<div class="content-box">
  <div class="content-box-header">
    <h3 style="cursor: s-resize; ">新增栏目</h3>
    <ul class="content-box-tabs">
      <li><a class="default-tab current" href="#tab1">Forms</a></li>
    </ul>
    <div class="clear"></div>
  </div>
  <div class="content-box-content">
    <div class="tab-content default-tab" id="tab1">
      <if condition="isset($notice)">
			<include file="Public:notice" status="{$notice.status}" message="{$notice.message}" />
      </if>
      <form action="" method="post" onsubmit="return checkForm();">
        <p>
          <label>栏目名称</label>
			<span class="tips align-right">* 请输入栏目名称</span>
          <input type="text" class="text-input small-input" name="name"  value="">
        </p>
        <p>
          <label>上级栏目</label>
		  <span class="tips align-right">* 请选择该栏目的上一级栏目</span>
          <select name="pid" class="small-input">
            <option value="0">顶级分类</option>
            {$categorySelect}
          </select>
        </p>
        <p>
        	<label>外部链接</label>
            <span class="tips align-right">* 如果是外部链接或php文件，请填写链接地址，否则请选择所属模型</span>
            <input type="radio" name="isOutUrl" value="1" />是 <input type="radio" name="isOutUrl" value="0" checked="checked" />否
        </p>
        <p id="outUrl" style="display:none">
        	<label>链接地址</label>
            <span class="tips align-right">* 请填写外部链接的地址，如：http://www.baidu.com或者./test.php</span>
            <input type="text" class="text-input small-input" name="outUrl">
        </p>
        <p id="model">
          <label>所属模型</label>
		  <span class="tips align-right">* 该模型决定了该栏目所显示的模版页面</span>
          <select name="model_id" class="small-input" onchange="isOutUrl(this)">
            <foreach name="model" item="list">
              <option value="{$list.id}">{$list.name}</option>
            </foreach>
          </select>
        </p>
        <p>
          <label>栏目排序</label>
		  <span class="tips align-right">* 数值越小，排序越靠前</span>
          <input type="text" class="text-input small-input" name="sort"  value="1">
        </p>
        <p>
          <input class="button" type="submit" value="保存">
        </p>
      </form>
    </div>
  </div>
</div>
<script>
	$(function(){
		$("input[name='isOutUrl']").click(function(){
			if($(this).val() == 1){
				$("#outUrl").show();
				$("#model").hide();
			}else{
				$("#outUrl").hide();
				$("#model").show();	
			}
		});
	});
	
	function checkForm(){
		if ($("input[name='name']").val() == ""){
			alert("亲~~请填写栏目名称哦！！");
			$("input[name='name']").focus();
			return false;
		}
		if ($("input[name='sort']").val() == ""){
			alert("亲~~您没有填写排序哦！！");
			$("input[name='sort']").focus();
			return false;
		}
		return true;
	}

</script>